<?php

/**
 * Service filter form base class.
 *
 * @package    dashboard
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseServiceFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'serv_type'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_container'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_option'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_quantity'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_size'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_freq'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_group'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Service'), 'add_empty' => true)),
      'serv_dateadded'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'serv_rent'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_rent_period'      => new sfWidgetFormChoice(array('choices' => array('' => '', 'month' => 'month', 'day' => 'day'))),
      'serv_rent_days'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_monthly'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_perton'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_tonnage'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_flatrate_tonnage' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_haul'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_adminfee'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_franchise'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_fuel'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_fuel_percent'     => new sfWidgetFormChoice(array('choices' => array('' => '', 'yes' => 'yes', 'no' => 'no'))),
      'serv_ignore_fuel'      => new sfWidgetFormChoice(array('choices' => array('' => '', 'no' => 'no', 'yes' => 'yes'))),
      'serv_latefee'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_recur'            => new sfWidgetFormChoice(array('choices' => array('' => '', 'ondemand' => 'ondemand', 'perminate' => 'perminate', 'item' => 'item'))),
      'serv_pricetype'        => new sfWidgetFormChoice(array('choices' => array('' => '', 'benchmark' => 'benchmark', 'newprice' => 'newprice', 'na' => 'na'))),
      'serv_custom_name'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_deleted'          => new sfWidgetFormChoice(array('choices' => array('' => '', 'no' => 'no', 'yes' => 'yes'))),
      'serv_all_flatrate'     => new sfWidgetFormChoice(array('choices' => array('' => '', 'yes' => 'yes', 'no' => 'no'))),
      'serv_item_unit'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_item_price'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'serv_item_total'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'account_id'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'serv_type'             => new sfValidatorPass(array('required' => false)),
      'serv_container'        => new sfValidatorPass(array('required' => false)),
      'serv_option'           => new sfValidatorPass(array('required' => false)),
      'serv_quantity'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'serv_size'             => new sfValidatorPass(array('required' => false)),
      'serv_freq'             => new sfValidatorPass(array('required' => false)),
      'serv_group'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Service'), 'column' => 'row_id')),
      'serv_dateadded'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'serv_rent'             => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'serv_rent_period'      => new sfValidatorChoice(array('required' => false, 'choices' => array('month' => 'month', 'day' => 'day'))),
      'serv_rent_days'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'serv_monthly'          => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'serv_perton'           => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'serv_tonnage'          => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'serv_flatrate_tonnage' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'serv_haul'             => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'serv_adminfee'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'serv_franchise'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'serv_fuel'             => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'serv_fuel_percent'     => new sfValidatorChoice(array('required' => false, 'choices' => array('yes' => 'yes', 'no' => 'no'))),
      'serv_ignore_fuel'      => new sfValidatorChoice(array('required' => false, 'choices' => array('no' => 'no', 'yes' => 'yes'))),
      'serv_latefee'          => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'serv_recur'            => new sfValidatorChoice(array('required' => false, 'choices' => array('ondemand' => 'ondemand', 'perminate' => 'perminate', 'item' => 'item'))),
      'serv_pricetype'        => new sfValidatorChoice(array('required' => false, 'choices' => array('benchmark' => 'benchmark', 'newprice' => 'newprice', 'na' => 'na'))),
      'serv_custom_name'      => new sfValidatorPass(array('required' => false)),
      'serv_deleted'          => new sfValidatorChoice(array('required' => false, 'choices' => array('no' => 'no', 'yes' => 'yes'))),
      'serv_all_flatrate'     => new sfValidatorChoice(array('required' => false, 'choices' => array('yes' => 'yes', 'no' => 'no'))),
      'serv_item_unit'        => new sfValidatorPass(array('required' => false)),
      'serv_item_price'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'serv_item_total'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'account_id'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('service_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Service';
  }

  public function getFields()
  {
    return array(
      'serv_id'               => 'Number',
      'serv_type'             => 'Text',
      'serv_container'        => 'Text',
      'serv_option'           => 'Text',
      'serv_quantity'         => 'Number',
      'serv_size'             => 'Text',
      'serv_freq'             => 'Text',
      'serv_group'            => 'ForeignKey',
      'serv_dateadded'        => 'Date',
      'serv_rent'             => 'Number',
      'serv_rent_period'      => 'Enum',
      'serv_rent_days'        => 'Number',
      'serv_monthly'          => 'Number',
      'serv_perton'           => 'Number',
      'serv_tonnage'          => 'Number',
      'serv_flatrate_tonnage' => 'Number',
      'serv_haul'             => 'Number',
      'serv_adminfee'         => 'Number',
      'serv_franchise'        => 'Number',
      'serv_fuel'             => 'Number',
      'serv_fuel_percent'     => 'Enum',
      'serv_ignore_fuel'      => 'Enum',
      'serv_latefee'          => 'Number',
      'serv_recur'            => 'Enum',
      'serv_pricetype'        => 'Enum',
      'serv_custom_name'      => 'Text',
      'serv_deleted'          => 'Enum',
      'serv_all_flatrate'     => 'Enum',
      'serv_item_unit'        => 'Text',
      'serv_item_price'       => 'Number',
      'serv_item_total'       => 'Number',
      'account_id'            => 'Number',
    );
  }
}
